<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function isNum(num) {
        let reg = /([0-9]+\.)*[0-9]+(\.[0-9]+)*/;
        let result = reg.test(num);
        if (result) {
          console.log(num, "是数字");
        } else {
          console.log(num, "不是数字");
        }
      }
      isNum(1.23);
      isNum(0.02);
      isNum(123);
      isNum(3e-2);
      isNum(3e4);
    </script>
  </body>
</html>
